/**
 * Created by tanjian on 2017/4/12.
 */
import React from 'react';
import {Table} from 'antd';

const data =[
    {"name":"牛奶","key":"1","price":"20","store":"300"},
    {"name":"饼干","key":"2","price":"30","store":"400"},
    {"name":"巧克力","key":"3","price":"40","store":"500"}
];
const columns = [{
    title: '名称',
    dataIndex: 'name',
    key: '1'
}, {
    title: '价格',
    dataIndex: 'price',
    key: '2'
}, {
    title: '库存',
    dataIndex: 'store',
    key: '3'
}, {
    title: '操作',
    key: 'operation',
    render: (text, record) => (
        <span>
            <a href="#" onClick={
                () => {
                    console.log(record.key);
                }
            }>添加{ record.name}到购物车</a>
        </span>
    )
}];


class Index extends React.Component{
    render(){
        return <Table columns={columns} dataSource={data} />
    }
}

export default Index;